Streams preview Class
Provides base protocol and behavior for rendering a stream preview. Should be combined with a tool on the same element that will actually manage and render the interface.
Constructor
Streams preview
-
[options]
-
[options.creatable.title="New
Parameters:
-
[options]
Object optionalthis object contains function parameters
-
publisherId
StringThe publisher's user id.
-
[streamName]
String optionalIf empty, and "creatable" is true, then this can be used to add new related streams.
-
[related]
Object optional, Optional information to add a relation from the newly created stream to another one. Usually set by a "Streams/related" tool. Can include:
-
[editable=true]
Boolean | Array optionalSet to false to avoid showing even authorized users an interface to replace the image or text. Or set to an array naming only certain fields, which the rendering method would hopefully recognize.
-
[closeable=true]
Boolean optionalSet to false to avoid showing even authorized users an option to closeable (or close) this stream
-
[creatable]
Object optionalOptional fields you can override in case if streamName = "",
-
[streamType="Streams/text/small"]
String optionalSet the type of the stream to be created -
[clickable=true]
Boolean optionalWhether the image composer image is clickable -
[addIconSize=100]
Number optionalThe size in pixels of the square add icon -
[options={}]
Number optionalAny options to pass to Q.Streams.create -
[preprocess]
Function optionalThis function receives (a callback, this tool, the event if any that triggered it). This is your chance to do any processing before the request to create the stream is sent. The function must call the callback. If you handled creating the stream yourself, pass the stream name as the first parameter, (and optionally the weight of the relation as the second parameter.) If you canceled the process, pass false instead as the first parameter. However, if you want to go ahead and let the preview tool call Q.Streams.create, you can pass here a plain Object with any fields to set for the stream, such as "title", "content", "attributes" (as JSON string), "name", etc.
-
-
[imagepicker]
Object optionalAny options to pass to the Q/imagepicker jquery plugin -- see its options.
-
[actions]
Object optionalAny options to pass to the Q/actions jquery plugin -- see its options.
-
[sizes]
Object optionalIf passed, uses this instead of Q.Streams.image.sizes for the sizes
-
[overrideShowSize]
Object optionalA hash of {icon: size} pairs to override imagepicker.showSize when the icon is a certain string. The empty string matches all icons.
-
[throbber="{{Q}}/img/throbbers/loading.gif"]
String optionalThe url of an image to use as an activity indicator when the image is loading
-
[cacheBust=null]
Number optionalNumber of milliseconds to use for combating the re-use of cached images when they are first loaded.
-
[beforeCreate]
Q.Event optionalAn event that occurs right before a composer requests to create a new stream
-
[onCreate]
Q.Event optionalAn event that occurs after a new stream is created by a creatable preview
-
[onComposer]
Q.Event optionalAn event that occurs after a composer is rendered. Tools that extend Streams/preview can bind this event to a method to override the contents of the composer.
-
[onRefresh]
Q.Event optionalAn event that occurs after a stream preview is rendered for an existing stream. Tools that extend Streams/preview can bind this event to a method to override the contents of the tool.
-
[onLoad]
Q.Event optionalAn event that occurs after the refresh calls its callback, which should happen when everything has fully rendered
-
[beforeClose]
Q.Event optionalOptionally set to a function that takes a callback, to display e.g. a dialog box confirming whether to close the stream. It should call the callback with no arguments, in order to proceed with the closing.
-
[onClose]
Q.Event optionalAn event that occurs after a stream with a preview has been closed
-
[templates]
Object optionalUnder the keys "views", "edit" and "create" you can override options for Q.Template.render . The fields passed to the template include "alt", "titleTag" and "titleClass"
-
-
[options.creatable.title="New
StringItem"] Optional title for the case when streamName = "", i.e. the composer
Item Index
Methods
Methods
hautoscroll
-
[options]
Plugin for Animated moving Element content inside it from let to right
Parameters:
-
[options]
Object optionaloptions object containing parameters for function
-
[scrollTime]
Number optionalscrollTime number of interval for content right movement in milliseconds
-
[pauseBefore]
Number optionalpauseBefore is a number for interval before animation starts in milliseconds
-
[pauseAfter]
Number optionalpauseAfter number of interval for content left movement to margin-left: 0 in milliseconds
-
icon
-
element
-
onLoad
-
[options]
Parameters:
-
element
HTMLElement -
onLoad
Function -
[options]
Object optional
iScroll
-
[object_or_string]
Just a helper for iScroll plugin. Needed to simplify applying iScroll and Q/scrollIndicators plugins.
Parameters:
-
[object_or_string]
Mixed optional-
[Object]
Object optionalan Object, then it's a hash of options, similar to these passed to iScroll plus additional parameters: "indicators": Defaults to true. Whether to show scroll indicators (apply Q/scrollIndicators plugin).
-
[x]
Number optionalx -
[y]
Number optionaly -
[hScrollbar]
Boolean optionalhScrollbar -
[vScrollbar]
Boolean optionalvScrollbar -
[hScroll]
Boolean optionalhScroll -
[hideScrollbar]
Boolean optionalhideScrollbar -
[fadeScrollbar]
Boolean optionalfadeScrollbar -
[useTransition]
Boolean optionaluseTransition -
[topOffset]
Number optionaltopOffset -
[onRefresh]
Q.Event optionalonRefresh -
[onBeforeScrollStart]
Q.Event optionalonBeforeScrollStart -
[onScrollStart]
Q.Event optionalonScrollStart -
[onScrollMove]
Q.Event optionalonScrollMove -
[onScrollEnd]
Q.Event optionalonScrollEnd -
[onTouchEnd]
Q.Event optionalonTouchEnd -
[showArrows]
Boolean optionalshowArrows -
[horizontalGutter]
Number optionalhorizontalGutter -
[verticalGutter]
Number optionalverticalGutter -
[maintainPosition]
Boolean optionalmaintainPosition -
[autoReinitialize]
Boolean optionalautoReinitialize -
[animateScroll]
Boolean optionalanimateScroll -
[hijackInternalLinks]
Boolean optionalhijackInternalLinks -
[indicators]
Boolean optionalindicators
-
-
[String]
String optionalIf a string, then it's a command which may be: "remove": Destroys iScroll together with Q/scrollIndicators.
-
pick
()
Set the image in the imagepicker
remove
()
Removes the imagepicker functionality from the element